package jvm;
/**
 * 基本数据类型封装类的演示
 * @author fidel
 */
public class BasicDataTypeWrapperClassDemo {
    public static void main(String[] args) {
        String str = "987654321";
        // String转换成Integer
        // j2se1.5引入自动拆装箱机制，基本数据类型变量与对应封装类的实例可以相互转换
        int num = Integer.parseInt(str);
        System.out.println(num);
        // String转Double
        str = "2.196348075";
        double b = Double.parseDouble(str);
        System.out.println(b);
        // String转Boolean
        str = "true";
        boolean c = Boolean.parseBoolean(str);
        System.out.println(c);
        // int转String
        num = 301;
        str = String.valueOf(num);
        System.out.println(str);
        // double转String
        b = 172.6530948;
        str = String.valueOf(b);
        System.out.println(str);
    }
}
